import pandas as pd

from utils.sult import suit

_sult = suit.keys()
df = pd.DataFrame(columns=_sult, index=['2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K', 'A'])
df['spade']['3'] = 1
df['spade']['4'] = 1
df['spade']['5'] = 1
df['spade']['7'] = 1
df['Diamond']['7'] = 1
df['Diamond']['7'] = 1
df['Club']['6'] = 1
df['Diamond']['6'] = 1
# df.loc[10]['Diamond']=1
print([i   for i in df])
c=(df.agg('sum', axis=0))
print(c[c>=4].index[0])
club =df['Club']
print(club[club>0])
print("同花", df.agg('sum', axis=0).agg('max') >= 5)  # 同花
a1 = (df.agg('sum', axis=1))
a1.index = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]

a1_exist = a1[a1>0]
a1_exist.sort_values(ascending=False,inplace=True)
# print(a1_exist.to_dict())
print(a1_exist)
print(a1_exist[a1_exist==4])
print(bool(len(a1_exist[a1_exist==4])))
print(a1_exist.to_list().count(2))
# for i in range(len(a1) - 4):
#     i += 2  # 牌号是从2开始的
#     if (
#             a1[i + 0] > 0 and
#             a1[i + 1] > 0 and
#             a1[i + 2] > 0 and
#             a1[i + 3] > 0 and
#             a1[i + 4] > 0
#     ):
#         print(True)
#
# print(df)

